﻿// Study0501.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
// 第五章 数据共享与保护 对象生存期

#include <iostream>
using namespace std;
int i = 1;
void other()
{
	static  int a = 2;
	static int b;
	int c = 10;
	a += 2;
	i += 32;
	c += 5;
	cout << "------OTHER--------\n";
	cout << "i:" << i << "  a:" << a << "  b:" << b << "  c:" << c << endl;
	b = a;
}

int main()
{
	static int a;
	int b=-10;
	int c=0;
	cout << "------MAIN--------\n";
	cout << "i:" << i << "  a:" << a << "  b:" << b << "  c:" << c << endl;
	c += 8;
	other();
	cout << "------MAIN--------\n";
	cout << "i:" << i << "  a:" << a << "  b:" << b << "  c:" << c << endl;
	i += 10;
	other();
	return 0;
}

